<?php
	class tag{
	
		public $tag=array(
			"page"=>array("block"=>0)
		);
		/* function _arclist($attr,$content){
			$id = isset($attr['id'])?$attr['id']:(isset($_GET['id'])?$_GET['id']:false);//栏目ID
			if(!$id){
				error("请指定arclist的id属性");
			}
			$limit = $attr['row'];
			$titlelen = isset($attr['titlelen'])?$attr['titlelen']:100;
			$str ='';
			$str.='<?php $db = k("newsview");'; 
			$str.='$row = $db->where("hd_news.id=\''.$id.'\'")->limit('.$limit.')->all();';
			$str.='foreach($row as $v):
				$v["title"] = mb_substr($v["title"],0,'.$titlelen.',"utf-8");
				$v["click"] = mb_substr($v["click"],0,'.$titlelen.',"utf-8");
				$v["thumb"] = mb_substr($v["thumb"],0,'.$titlelen.',"utf-8");
				$thumb=$v["thumb"];
				$v["thumburl"]="<img src=\''.__ROOT__.'/$thumb \'/>";
				$v["body"] = mb_substr($v["body"],0,'.$titlelen.',"utf-8");
				$v["username"] = mb_substr($v["username"],0,'.$titlelen.',"utf-8");
				$v["keywords"] = mb_substr($v["keywords"],0,'.$titlelen.',"utf-8");
				$v["addtime"] = mb_substr(date("Y-m-d",$v["addtime"]),0,'.$titlelen.',"utf-8");
				?>
			';
			$str.=$content;
			$str.='<?php endforeach;?>';
			return $str;
		} */
		
		 function _listshow($attr,$content){
		
			$limit = $attr['row'];
			$titlelen = isset($attr['titlelen'])?$attr['titlelen']:100;
			$str ='';
			$str.='<?php $db = M("news");'; 
			$str.='$count = $db->where("catid=3")->count();';
			$str.='$page = new page($count,'.$limit.');';
			$str.='$sql_limit = $page->limit();';
			$str.='$row = $db->where("catid=3")->order("addtime desc")->limit($sql_limit)->all();';
			$str.='foreach($row as $v):
				$v["id"] = mb_substr($v["id"],0,'.$titlelen.',"utf-8");
				$id=$v["id"];
				$thumb=$v["thumb"];
				$v["thumburl"]="<img src=\''.__ROOT__.'/$thumb \'/>";
				$v["title"] = mb_substr($v["title"],0,'.$titlelen.',"utf-8");
				$v["titleurl"]="<a href=\''.__WEB__.'?c=news&m=index&id=$id \'>".$v["title"]."</a>";
				$v["addtime"] = mb_substr(date("Y-m-d",$v["addtime"]),0,'.$titlelen.',"utf-8");
				?>
			';
			$str.=$content;
			$str.='<?php endforeach;?>';
			return $str;
		} 
		
		function _page($attr,$content){
			$style=isset($attr['style'])?$attr['style']:1;
			return '<?php echo $page->show('.$style.');?>';
		}
		
		
		
	} 
	/* $v["channelurl"]="<a href=\''.__CONTROL__.'/l/id/'.$id.'\'>".$v["cname"]."</a>"; */
?>